<template>
  <Dialogdrawerdefect :ddtvisible="dialogVisible" size="750px" direction="rtl" :has-modal="true" :modal="true" :close-on-click-modal="true" @close="handleClose" :title="`操作记录详情【${ruleForm.operatorDate}】`">
    <div class="cont_box" v-loading="loading">
      <AppInfoTitle>
        <b class="fs-16">{{`操作记录详情【${ruleForm.operatorDate}】`}}</b>
      </AppInfoTitle>
      <el-row>
        <el-col :span="12">
          <AppInfoItem label="医院名称" :txt="ruleForm.hospitalName" style="width: 100%"/>
        </el-col>
        <el-col
          :span="12"
          v-for="(v,index) in ruleForm.appointmentListDmbContents"
          :key="index"
        >
          <AppInfoItem :label="v.name" :txt="v.value" style="width: 100%"/>
        </el-col>
        <el-col :span="12">
          <AppInfoItem label="表名" :txt="ruleForm.tabelName" style="width: 100%"/>
        </el-col>
        <el-col :span="12">
          <AppInfoItem label="表Id" :txt="ruleForm.tabelId" style="width: 100%"/>
        </el-col>
        <el-col :span="12">
          <AppInfoItem label="操作方法" :txt="ruleForm.operatorStatus" style="width: 100%"/>
        </el-col>
        <el-col :span="12">
          <AppInfoItem label="操作来源" :txt="ruleForm.operatorId" style="width: 100%"/>
        </el-col>
        <el-col :span="12">
          <AppInfoItem label="IP地址" :txt="ruleForm.ipAddress" style="width: 100%"/>
        </el-col>
        <el-col :span="12">
          <AppInfoItem label="模块名称" :txt="ruleForm.moduleName" style="width: 100%"/>
        </el-col>
        <el-col :span="24">
          <AppInfoItem label="sql语句" :txt="ruleForm.sql" style="width: 100%" min-height="60px"/>
        </el-col>
        <el-col :span="24">
          <AppInfoItem label="备注" :txt="ruleForm.remark2" style="width: 100%" min-height="60px"/>
        </el-col>
      </el-row>
      <el-table :data="ruleForm.appointmentFilters">
        <el-table-column
          prop="parametersName"
          label="参数说明">
        </el-table-column>
        <el-table-column
          prop="parametersType"
          label="参数类型">
        </el-table-column>
        <el-table-column
          prop="parametersValues"
          label="参数值"
        >
        </el-table-column>
      </el-table>
      <div class="buttons">
        <div class="left-buttons">
          <el-button size="small" @click="handleClose">关 闭</el-button>
        </div>
      </div>
    </div>
  </Dialogdrawerdefect>
</template>
<script>
import Dialogdrawerdefect from '@/components/dialogbox/dialogDrawer'
import { setuplogGetmodel } from '@/api/api.js'
import AppInfoItem from '@/components/appInfoItem/index'
import AppInfoTitle from '@/components/appInfoTitle/index'
export default {
  name: 'EditDialog',
  components: {
    Dialogdrawerdefect,
    AppInfoItem,
    AppInfoTitle
  },
  props: {
    dialogVisible: {
      type: Boolean,
      default: false
    },
    id: {
      String,
      default: ''
    },
    hospitalCode: {
      String,
      default: ''
    }

  },
  data() {
    return {
      ruleForm: {},
      allContentArr: [],
      allContentTable: [],
      loading: false
    }
  },
  watch: {
    id(val) {
      if (val) {
        this.getDetail(val)
      }
    }
  },
  methods: {
    handleClose() {
      this.$emit('myClose')
    },
    async getDetail(id) {
      await this.$getHospitalList()
      this.loading = true
      setuplogGetmodel({ id: id, hospitalCode: this.hospitalCode }).then(res => {
        this.loading = false
        if (res && res.code === 10000) {
          this.ruleForm = JSON.parse(JSON.stringify(res.content))
          let obj = this.mx_hospitalList.find(v => {
            return v.code === this.ruleForm.hospitalCode
          })
          if (obj) {
            this.ruleForm.hospitalName = obj.name
          }
        }
      }).catch(() => {
        this.loading = false
      })
    }
  }
}
</script>
<style lang="scss" scoped>
// .cont_box{
//   height: calc(100vh - 98px);
//   padding: 0 24px 45px;
//   overflow-y: auto;
// }
</style>
